//
//  RCUserVCFansListCell.m
//  RocketProject
//
//  Created by chen jiedan on 13-8-25.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "RCUserVCFansListCell.h"
#import "UIImageView+WebCache.h"
#import "UIColor-Expanded.h"
#import "CommonDefines.h"

@implementation RCUserVCFansListCell{
    UIImageView *_leftImageView;
    UILabel     *_nickName;
    UILabel     *_level;
    UILabel     *_totalScore;
    UILabel     *_tatalCheckIn;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self createPlaceHolder];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void) createPlaceHolder
{
    _leftImageView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 15, 53, 46)];
    [self.contentView addSubview:_leftImageView];
    [_leftImageView release];
    
    _nickName = [[UILabel alloc] initWithFrame:CGRectMake(85, 20, 100, 20)];
    [self.contentView addSubview:_nickName];
    [_nickName setBackgroundColor:[UIColor clearColor]];
    _nickName.font = [UIFont fontWithName:kFontNameHelvetica size:18];
    _nickName.textColor = [UIColor colorWithRed:80.0/255 green:80.0/255 blue:80.0/255 alpha:1];
    [_nickName release];
    
    
    _level = [[UILabel alloc] initWithFrame:CGRectMake(190, 20, 110, 18)];
    [self.contentView addSubview:_level];
    [_level setBackgroundColor:[UIColor clearColor]];
    _level.font = [UIFont fontWithName:kFontNameHelvetica size:18];
    _level.textColor = [UIColor colorWithRed:255.0/255 green:143.0/255 blue:74.0/255 alpha:1];
    [_level release];
    
    
    _totalScore = [[UILabel alloc] initWithFrame:CGRectMake(85, 45, 115, 15)];
    [self.contentView addSubview:_totalScore];
    [_totalScore setBackgroundColor:[UIColor clearColor]];
    _totalScore.font = [UIFont fontWithName:kFontNameHelvetica size:15];
    _totalScore.textColor = kNormalTextColor;
    [_totalScore release];
    
    
    
    _tatalCheckIn = [[UILabel alloc] initWithFrame:CGRectMake(200, 45, 120, 15)];
    [self.contentView addSubview:_tatalCheckIn];
    [_tatalCheckIn setBackgroundColor:[UIColor clearColor]];
    _tatalCheckIn.font = [UIFont fontWithName:kFontNameHelvetica size:15];
    _tatalCheckIn.textColor = kNormalTextColor;
    [_tatalCheckIn release];
    
    
    UIView *horizonLine = [[UIView alloc]initWithFrame:CGRectMake(15, 79, 320-30, 1)];
    horizonLine.backgroundColor = [UIColor colorWithHex:0xffe6e6e6];
    [self.contentView addSubview:horizonLine];
    [horizonLine release];
}

- (void) bindData:(RCFansFollowerItemDataModel *)item
{
    [_leftImageView setImageWithURL:[NSURL URLWithString:item.picUrl] placeholderImage:[UIImage imageNamed:@"icon_RCUserVCOrderListIMG"]];

//    [_leftImageView setImageWithURL:nil placeholderImage:[UIImage imageNamed:@""]];
    _nickName.text = item.userName;
//    _level.text = @"14级"; 这个字段暂时不用
    if ([item.signin intValue] == 0) {
        _totalScore.hidden = YES;
        _tatalCheckIn.hidden = YES;
    }else{
        _totalScore.hidden = NO;
        _tatalCheckIn.hidden = NO;
        _totalScore.text =  [NSString stringWithFormat:@"总积分:%@分 ",item.score];
        _tatalCheckIn.text = [NSString stringWithFormat:@"签到:%@次",item.signin];
    }

}
@end
